package com.chrissy.music.controller;

import com.chrissy.music.common.response.SysCaptchaResponse;
import com.chrissy.music.common.result.Result;
import com.chrissy.music.system.service.SysCaptchaService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Johnson
 */
@RestController
@Tag(name = "验证码", description = "验证码")
@RequiredArgsConstructor
public class SysCaptchaController {

    private final SysCaptchaService sysCaptchaService;

    @Operation(summary = "生成验证码")
    @GetMapping("/captchaImage")
    public Result<SysCaptchaResponse> getCode() {
        SysCaptchaResponse sysCaptchaResponse = sysCaptchaService.generate();
        return Result.success(sysCaptchaResponse);
    }

}
